home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / misc / update / tpasc302.cpt / TCL Update / New More Files / CBitMapPane.p next >
Encoding:
Text File  |  1990-05-11  |  3.0 KB  |  142 lines

  1. {****************************************************}
  2. {         CBitMapPane.p}
  3. {}
  4. {        The BitMapPane Class}
  5. {}
  6. {        SUPERCLASS = CPanorama}
  7. {}
  8. {        Copyright ⌐ 1989, Symantec Corporation.  All rights reserved.            }
  9. {}
  10. {****************************************************}
  11.  
  12. unit CBitMapPane;
  13.  
  14. interface
  15.  
  16.     uses
  17.         TCL, MoreTCL;
  18.  
  19.  
  20. implementation
  21.  
  22.  
  23.  
  24. {*** C O N S T R U C T I O N / D E S T R U C T I O N   M E T H O D S ***}
  25.  
  26.  
  27.  
  28. {****************************************************}
  29. { IBitMapPane}
  30. {}
  31. {        Initialize a BitMapPane object}
  32. {}
  33. {****************************************************}
  34.  
  35.     procedure CBitMapPane.IBitMapPane (anEnclosure: CView; aSupervisor: CBureaucrat; aWidth, aHeight, aHEncl, aVEncl: integer; aHSizing, aVSizing: SizingOption; aBounds: Rect; aBitMap: CBitMap; makePort: Boolean);
  36.         var
  37.             theBitMap: CBitMap;     { Altered by TCL Weaver 1.0 (5/9/90) }
  38.  
  39.     begin
  40.         IPanorama(anEnclosure, aSupervisor, aWidth, aHeight, aHEncl, aVEncl, aHSizing, aVSizing);
  41.  
  42.         bounds := aBounds;
  43.         position.h := bounds.left;
  44.         position.v := bounds.top;
  45.  
  46.         if aBitMap = nil then
  47.             begin
  48.                 new(theBitMap);     { Altered by TCL Weaver 1.0 (5/9/90) }
  49.                 itsBitMap := theBitMap;
  50.                 itsBitMap.IBitMap(aBounds.right - aBounds.left, aBounds.bottom - aBounds.top, makePort);
  51.  
  52.     {Exit if we couldn't create the bitmap.                  }
  53.     {Someone further up the call chain (i.e.,                 }
  54.     {CArtClassDoc.BuildWindow) should                    }
  55.     {detect the problem and tell gError to post an alert.    }
  56.  
  57.                 if itsBitMap.macBitMap.baseAddr = nil then
  58.                     Exit(IBitMapPane);
  59.  
  60.                 itsBitMap.SetBoundsOrigin(aBounds.left, aBounds.top);
  61.             end
  62.         else
  63.             itsBitMap := aBitMap;
  64.  
  65.         autoRefresh := FALSE;
  66.     end;
  67.  
  68.  
  69. {****************************************************}
  70. { Free (OVERRIDE)}
  71. {}
  72. {        Dispose of a BitMapPane}
  73. {}
  74. {****************************************************}
  75.  
  76.     procedure CBitMapPane.Free;
  77.     begin
  78.         if itsBitMap <> nil then
  79.             itsBitMap.Free;
  80.  
  81.         inherited Free;
  82.     end;
  83.  
  84.  
  85.  
  86. {*** A C C E S S I N G   M E T H O D S ***}
  87.  
  88.  
  89.  
  90. {****************************************************}
  91. { SetBitMap}
  92. {}
  93. {        Specify the BitMap associated with a BitMapPane}
  94. {}
  95. {****************************************************}
  96.  
  97.     procedure CBitMapPane.SetBitMap (aBitMap: CBitMap);
  98.     begin
  99.         itsBitMap := aBitMap;                { Set instance variable            }
  100.     end;
  101.  
  102.  
  103. {****************************************************}
  104. { GetBitMap}
  105. {}
  106. {        Return a reference to the BitMap associated with a BitMapPane}
  107. {}
  108. {****************************************************}
  109.  
  110.     function CBitMapPane.GetBitMap: CBitMap;
  111.     begin
  112.         GetBitMap := itsBitMap;
  113.     end;
  114.  
  115.  
  116.  
  117. {*** D R A W I N G   M E T H O D S ***}
  118.  
  119.  
  120.  
  121. {****************************************************}
  122. { Draw (OVERRIDE)}
  123. {}
  124. {        Draw a BitMapPane}
  125. {}
  126. {****************************************************}
  127.  
  128.     procedure CBitMapPane.Draw (var area: Rect);
  129.         var
  130.             temp: Boolean;
  131.  
  132.     begin
  133.         if itsBitMap <> nil then
  134.             begin
  135.                 temp := SectRect(area, itsBitMap.macBitMap.bounds, area);
  136.  
  137.                 itsBitMap.CopyFrom(area, area, nil);
  138.             end;
  139.     end;
  140.  
  141.  
  142. end.